<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>jq</title>
</head>
<body>
  
  <script type="text/javascript" src="../callback/Callback.js"></script>
  <script src="Deferred.js"></script>
  <script type="text/javascript">
    
    /*var df = Deferred()
    df.resolve(window,'xu')

    df.done(function (name) {
      alert('你好' + name)
    })*/

    function def () {
      var df = Deferred()
      var data = [
        {
          name: 'xu',
          age: 21
        },
        {
          name: 'zhou',
          age: 22
        }
      ]
      setTimeout(function () {
        df.resolve(window, data)
      },500)
      return df
    }

    def().done(function (data) {
      document.write(data.length)
    })




  </script>
</body>
</html>